<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>登录 - 锐聘网</title>
<link href="css/base.css" type="text/css" rel="stylesheet" />
<link href="css/login.css" type="text/css" rel="stylesheet" />
<meta content="大学生求职,大学生就业,大学生招聘,IT人才,IT人才招聘,大学生名企招聘,,大学生找工作,IT名企招聘，IT行业招聘，IT企业快速入职" name="keywords">
<meta content="锐聘专注于为企业提供高效的人力资源解决方案，同时面向IT类技术人才推出快速一站式免费就业服务。秉承QST青软实训人才服务理念，为数千家企业量身定做个性化、全程化的人才培养体系，同时帮助中高级人才铺设成功之路，为人才和企业架设起沟通之桥。" name="description">
  <style>
    #errorMsg{
      display: none;
      font-size: 15px;
      font-weight: 700;
      color: #cd0a0a;
      width: 150px;
      height: 32px;
      margin-left: 90px;
    }
  </style>
</head>


<body>
<iframe src="top.jsp" width="100%" height="100"  scrolling="no" frameborder="0" ></iframe>
<div class="content">
  <div class="page_name">登陆</div>
  <div class="login_content">
    <div class="login_l">
      <p class="font14">使用注册邮箱登录</p>

     <!-- <form action="/itoffer/loginServlet" method="get">-->

        <div class="span1">
          <label class="tn-form-label">邮箱：</label>
          <input name="applicant_email" class="tn-textbox" type="text">
          <p style="height: 60px"><span id="errorMsg">用户名或密码错误</span></p>
          <label class="tn-form-label">密码：</label>
          <input  name="applicant_pwd" class="tn-textbox"  type="password">
          <br>
          <br>
          <input  type="button" class="tn-button-text" value="登   录" style="margin-left: 80px" onclick="sub()">
          &nbsp; &nbsp; &nbsp;
          <input id="remember" name="remember" type="checkbox"><span>记住密码</span>

        </div>
        <div class="tn-form-row-button">
        </div>

<!--      </form>-->
      <div class="clear"></div>
    </div>
    <div class="login_r">
      <p align="center"> <b>还没有帐号？</b><a  href="register.html">10秒钟快速注册</a></p>
    
      <div><img src="images/login_pic.jpg"></div>
    
      <div class="clear"></div>
    </div>
    <div class="clear"></div>
  </div>
</div>
<iframe src="foot.jsp" width="100%" height="150"  scrolling="no" frameborder="0" ></iframe>
<script src="js/axios-0.18.0.js"></script>
<script src="js/js.cookie.js"></script>
<script type="text/javascript">

  //获取表单对象
  var _applicant_email = document.getElementsByName("applicant_email")[0];
  var _applicant_pwd = document.getElementsByName("applicant_pwd")[0];
  var _remember = document.getElementsByName("remember")[0];



  //获取保存在浏览器的cookie
  let applicantPwd = Cookies.get("applicant_pwd");
  let applicantEmail = Cookies.get("applicant_email");

  if(applicantPwd!=null&&applicantEmail!=null){
    //页面加载事件，页面一加载就将表单密码填好
    window.onload = function (){
      _applicant_email.value =applicantEmail;
      _applicant_pwd.value =applicantPwd;
      _remember.checked = "checked";
    }
  }
  //console.log(applicantPwd)




    var errorMsg = document.getElementById("errorMsg");
    var submit = document.getElementsByClassName("tn-button-text")[0];
    var applicant_email;
    var applicant_pwd;
    var remember;
    function sub(){
      //传参数赋值
      applicant_email = _applicant_email.value;
      applicant_pwd = _applicant_pwd.value;

      if(_remember.checked){
        _remember.value=1;
        remember = _remember.value;
      }else {
        _remember.value=0;
        remember = _remember.value;
      }

      //console.log(applicant_email.value)
      var _this = this;
      axios({
        method:"post",
        url:"http://localhost:8080/itoffer/loginServlet?",
        params: {
          applicant_email: applicant_email,
          applicant_pwd: applicant_pwd,
          remember: remember
        }
      }).then(function (resp) {
        //如果响应的数据为布尔值false,取反显示文字
        if(!resp.data){
          errorMsg.style.display = "block";
        }else{
          window.location.href = resp.data;
        }

      })
    }


</script>
</body>
</html>
